//
//  UITextField+Extension.m
//  exercise
//
//  Created by apple on 16/5/5.
//  Copyright © 2016年 Apple. All rights reserved.
//

#import "UITextField+Extension.h"

@implementation UITextField (Extension)


+ (instancetype)textFieldWithPlaceholder:(NSString *)placeholder fontSize:(CGFloat)fontSize {
    
    UITextField *textField = [[UITextField alloc] init];
    
    textField.placeholder = placeholder;
    textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    textField.borderStyle = UITextBorderStyleRoundedRect;
    textField.font = [UIFont systemFontOfSize:fontSize];
    
    return textField;
}


+ (instancetype)textFieldWithPlaceholder:(NSString *)placeholder fontSize:(CGFloat)fontSize leftViewImageName:(NSString *)imageName {
    
    UITextField *textField = [[UITextField alloc] init];
    
    UIImageView *leftView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
    
    leftView.bounds = CGRectMake(0, 0, 30, 30);
    leftView.contentMode = UIViewContentModeCenter;
    textField.leftView = leftView;
    textField.leftViewMode = UITextFieldViewModeAlways;
    
    
    textField.placeholder = placeholder;
    textField.clearButtonMode = UITextFieldViewModeWhileEditing;
    textField.borderStyle = UITextBorderStyleRoundedRect;
    textField.font = [UIFont systemFontOfSize:fontSize];
    
    return textField;
}



@end
